home *** CD-ROM | disk | FTP | other *** search
/ Software Vault: The Gold Collection / Software Vault - The Gold Collection (American Databankers) (1993).ISO / cdr28 / mxmnu239.zip / QUICKNOV.MNU < prev    next >
Text File  |  1993-03-22  |  14KB  |  685 lines

  1. Comment
  2. ==========================================================
  3.  
  4. Copyright 1990-92 by Marc Perkel * All right reserved.
  5.  
  6. This menu is a sample of a Novell ready menu. You can easilly modify it
  7. to suit your needs.
  8.  
  9. To add a choice to a menu simply use the AddChoice command
  10. then add the appropiate Onkey statement.
  11. The menu will make the size adjustments accordinaly.
  12.  
  13.   Example:
  14.       AddChoice("Print Console",10)
  15.       ...
  16.       ...
  17.       OnKey Task(10)
  18.         PConsole
  19.       ...
  20.  
  21. If you want to change the menu's center, pass the XY
  22. coordinates to menu's CenterStretchBox procedure.
  23.  
  24.    Example:
  25.       CenterStretchBox("Menu Header",40,12)
  26.  
  27. This will cause the menu to center at Col 40, Row 12
  28.  
  29. Instead of defining the center of the box, there is a command
  30. CornerStretchBox where the box grows down and right.
  31.  
  32.    Example:
  33.       CornerStretchBox("Menu Header",8,6)
  34.  
  35. To control custom features, edit CUSTOM.INC and other INCLUDE Files.
  36.  
  37. =========================================================
  38. EndComment
  39.  
  40. ;------ Create Variables
  41.  
  42. Var
  43.   PrintQueueChoices
  44.   PortChoices
  45.   MyServer
  46.   AllUsers
  47.   NetAddress
  48.   Station
  49.   UserName
  50.   BMess
  51.   TitleBackColor
  52.   TitleInsideColor
  53.   PersonalMenu
  54.   FilePicked
  55.   KeepUsersInMenu
  56.  
  57. KeepUsersInMenu = False    ;set to True if you want to lock in users
  58.  
  59. MyServer = NovDefaultServer
  60. Station  = Str(NovConnection)
  61. UserName = NovMyLoginName
  62.  
  63. ;------ Read network address
  64.  
  65. NetAddress = NovStationAddress (NovConnection)
  66.  
  67. ;------ Personalize Your Screen Messages
  68.  
  69. StatusLineText = 'User: ' + UserName + '  *  Server: ' + MyServer
  70. StatusLineText = StatusLineText + '  *  Address: ' + NetAddress
  71. if length(StatusLineText) < 64
  72.    StatusLineText = StatusLineText + '  *  Dos: ' + DosVersionString
  73. endif
  74.  
  75. MenuTitle = 'Computer Tyme Master Menu'
  76.  
  77. Comment
  78. ==========================================================
  79.  
  80. If you want to branch to a personal menu then this routine test for the
  81. existence of a menu in the users H: directory with the same name as the
  82. users login name. It then sets an environment variable indicating if it
  83. was found. This keeps the menu fast because the test need only be made
  84. once.
  85.  
  86. ==========================================================
  87. EndComment
  88.  
  89. ;------ Set Personal Menu if Environment Variable PMENU exists.
  90.  
  91. PersonalMenu = ReadEnv('PMENU')
  92.  
  93. ;------ Load menu look and feel include files
  94.  
  95. Include 'CUSTOM.INC'
  96.  
  97. Comment
  98. ==========================================================
  99.  
  100. MarxMenu is capable of software metering. This means that it can limit
  101. the number of users of an application to a fixed amount.
  102.  
  103.   OnKey Task (2)
  104.      |if Limit('LOTUS',6) then Return  ;limit Lotus to 6 Users
  105.      CD \PUBLIC\LOTUS
  106.      123
  107.  
  108. Read the METER.INC file for more details.
  109.  
  110. ==========================================================
  111. EndComment
  112.  
  113. Include 'METER.INC'  ;Software Metering
  114.  
  115. Comment
  116. ==========================================================
  117.  
  118. I have defined a procedure called CenterStretchBox which takes as
  119. parameters a menu title, array of choices, and the XY coordinants
  120. of the center of the window. CenterStretchBox then displays all the
  121. choices and numbers them. This method allows me to update the menu
  122. more quickly.
  123.  
  124. ==========================================================
  125. EndComment
  126.  
  127. AppendArray(PortChoices,'Lpt1')
  128. AppendArray(PortChoices,'Lpt2')
  129. AppendArray(PortChoices,'Lpt3')
  130.  
  131. Comment
  132. =================================
  133.  
  134. In order to add menu choices conditionally you would append the
  135. choices to the end of the array after all the default choices
  136. are set. For Example:
  137.  
  138.    if InGroup("ACCOUNTING")
  139.       AddChoice("Payroll Menu",10)
  140.    endif
  141.  
  142. Here is where menus are created.
  143.  
  144. =================================
  145. EndComment
  146.  
  147. ;----- Main Menu
  148.  
  149. AddChoice('Accounting',1)
  150. AddChoice('Word Processing',2)
  151. AddChoice('SpreadSheet',3)
  152. AddChoice('DataBase',4)
  153. AddChoice('Graphics',5)
  154. AddChoice('Communication',6)
  155. AddChoice('Publishing',7)
  156. AddChoice('Utilities',20)
  157. if PersonalMenu > '' then AddChoice('Personal Menu',25)
  158.  
  159. CornerStretchBox ('Main Menu',11,6)
  160.  
  161. OnKey Task(1)
  162.    |Error('Put Code for Accounting here.')
  163.  
  164. OnKey Task(2)
  165.    |Error('Put Code for Word Processing here.')
  166.  
  167. OnKey Task(3)
  168.    |Error('Put Code for SpreadSheet here.')
  169.  
  170. OnKey Task(4)
  171.    |Error('Put Code for DataBase here.')
  172.  
  173. OnKey Task(5)
  174.    |Error('Put Code for Graphics here.')
  175.  
  176. OnKey Task(6)
  177.    |Error('Put Code for Communication here.')
  178.  
  179. OnKey Task(7)
  180.    |Error('Put Code for Publishing here.')
  181.  
  182. OnKey Task(20)
  183.    ^Util
  184.  
  185. OnKey Task(25)
  186.    |Bat 'Marx ' + PersonalMenu
  187.  
  188. OnKey ESC
  189.    |if NovConsoleOperator or not KeepUsersInMenu
  190.    |   LeaveMenu
  191.    |endif
  192.  
  193. ;----- Util Menu
  194.  
  195. :Util
  196.  
  197. AddChoice('Printer Select',1)
  198. AddChoice('Format Disk Menu',2)
  199. AddChoice('Dos Functions',3)
  200. AddChoice('Novell Information',4)
  201. AddChoice('Novell User Options',5)
  202. if NovConsoleOperator
  203.    AddChoice('Novell Utilities',6)
  204.    AddChoice('Maintainence',7)
  205.    AddChoice('Menu Utilities',8)
  206.    AddChoice('Command Line',9)
  207. endif
  208.  
  209. CornerStretchBox ('Utility Menu',43,6)
  210.  
  211. OnKey Task(1)
  212.   |SelectPrintQueue
  213.   |Dispose Choices
  214.   |LastKey = ' '
  215.  
  216. OnKey Task(2)
  217.   |SelectFormat
  218.   |LastKey = ' '
  219.  
  220. OnKey Task(3)
  221.   ^Dos
  222.  
  223. OnKey Task(4)
  224.   ^NovInfo
  225.  
  226. OnKey Task(5)
  227.   ^NovUser
  228.  
  229. OnKey Task(6)
  230.   ^NovUtils
  231.  
  232. OnKey Task(7)
  233.   ^Maint
  234.  
  235. OnKey Task(8)
  236.   ^MenuUtil
  237.  
  238. OnKey Task(9)
  239.   |if ExistOnPath('DOLIST.EXE') > ''
  240.      DropTo DoList
  241.   |else
  242.   |  Bat 'DropTo ' + ReadEnv('COMSPEC')
  243.   |endif
  244.  
  245. ;----- Dos Menu
  246.  
  247. :Dos
  248.  
  249. AddChoice('Directory Master',1)
  250. AddChoice('Pick Directory',2)
  251. AddChoice('Show Directory',3)
  252. AddChoice('Free Space',4)
  253. AddChoice('Memory Map',5)
  254. AddChoice('Device Drivers',6)
  255.  
  256. CenterStretchBox ('DOS Menu',38,15)
  257.  
  258. OnKey Task(1)
  259.   |if NovConsoleOperator
  260.      DropTo DM3
  261.   |else
  262.      DropTo DMLITE
  263.   |endif
  264.  
  265. OnKey Task(2)
  266.    PD
  267.  
  268. OnKey Task(3)
  269.    D/W
  270.  
  271. OnKey Task(4)
  272.    Free
  273.    Pause
  274.  
  275. OnKey Task(5)
  276.    RamMap
  277.    Pause
  278.  
  279. OnKey Task(6)
  280.    Device
  281.    Pause
  282.  
  283.  
  284. ;----- Novell Utilities Menu
  285.  
  286. :NovUtils
  287.  
  288. AddChoice('Session Management',1)
  289. AddChoice('File Management',2)
  290. AddChoice('Volume Information',3)
  291. AddChoice('System Configuration',4)
  292. AddChoice('File Server Monitoring',5)
  293. AddChoice('Print Queue Management',6)
  294. AddChoice('Print Job Configurations',7)
  295. AddChoice('Printer Definitions',8)
  296. AddChoice('Folio Help System',9)
  297.  
  298. CenterStretchBox ('Novell Utilities',38,15)
  299.  
  300. OnKey Task(1)
  301.    Session
  302.  
  303. OnKey Task(2)
  304.    Filer
  305.  
  306. OnKey Task(3)
  307.    VolInfo
  308.  
  309. OnKey Task(4)
  310.    Syscon
  311.  
  312. OnKey Task(5)
  313.    FConsole
  314.  
  315. OnKey Task(6)
  316.    PConsole
  317.  
  318. OnKey Task(7)
  319.    PrintCon
  320.  
  321. OnKey Task(8)
  322.    PrintDef
  323.  
  324. OnKey Task(9)
  325.    P:Help
  326.  
  327. ;----- Novell Information Menu
  328.  
  329. :NovInfo
  330.  
  331. AddChoice('UserList',1)
  332. AddChoice('Drive Map',2)
  333. AddChoice('Current Dir',3)
  334. AddChoice('Directory Rights',4)
  335. AddChoice('List Servers',5)
  336. AddChoice('Who Am I?',6)
  337. AddChoice('Trustees',7)
  338. AddChoice('System Time',8)
  339. AddChoice('ChkVol',9)
  340. AddChoice('Printer Status',10)
  341.  
  342. CenterStretchBox ('Novell Information',38,15)
  343.  
  344. OnKey Task(1)
  345.    UserList/A
  346.    Echo.
  347.    Pause
  348.  
  349. OnKey Task(2)
  350.    Map
  351.    Echo.
  352.    Pause
  353.  
  354. OnKey Task(3)
  355.    NDir
  356.    Pause
  357.  
  358. OnKey Task(4)
  359.    Rights
  360.    Echo.
  361.    Pause
  362.  
  363. OnKey Task(5)
  364.    SList
  365.    Echo.
  366.    Pause
  367.  
  368. OnKey Task(6)
  369.    WhoAmI/A
  370.    Echo.
  371.    Pause
  372.  
  373. OnKey Task(7)
  374.    TList
  375.    Echo.
  376.    Pause
  377.  
  378. OnKey Task(8)
  379.    SysTime
  380.    Echo.
  381.    Pause
  382.  
  383. OnKey Task(9)
  384.    ChkVol
  385.    Echo.
  386.    Pause
  387.  
  388. OnKey Task(10)
  389.    Capture Show
  390.    Echo.
  391.    Pause
  392.  
  393. ;----- Novell User Menu
  394.  
  395. :NovUser
  396.  
  397. AddChoice('Change Password',1)
  398. AddChoice('Block Messages',2)
  399. AddChoice('Receive Messages',3)
  400. AddChoice('End Printer Capture',4)
  401. AddChoice('Send a Message',5)
  402.  
  403. CenterStretchBox ('Novell User Menu',38,15)
  404.  
  405. OnKey Task(1)
  406.    SetPass
  407.  
  408. OnKey Task(2)
  409.    CastOff
  410.  
  411. OnKey Task(3)
  412.    CastOn
  413.  
  414. OnKey Task(4)
  415.    EndCap
  416.  
  417. OnKey Task(5)
  418.    |SendMessage
  419.  
  420. ;----- Maintenence Menu
  421.  
  422. :Maint
  423.  
  424. AddChoice('Tape Backup',1)
  425. AddChoice('Delete *.BAK Files',2)
  426. AddChoice('Delete *.MRX Files',3)
  427.  
  428. CenterStretchBox ('Maintenence Menu',38,15)
  429.  
  430. OnKey Task(1)
  431.    |Error('Put Code for your Tape Backup Software here.')
  432.  
  433. OnKey Task(2)
  434.    Whereis *.BAK /D
  435.  
  436. OnKey Task(3)
  437.    Whereis *.MRX /D
  438.  
  439. ;----- Menu Utilities
  440.  
  441. :MenuUtil
  442.  
  443. AddChoice('Edit this Menu',1)
  444. AddChoice('View Include Files',2)
  445. AddChoice('Edit Include Files',3)
  446. AddChoice('View a Menu File',4)
  447. AddChoice('Edit a Menu File',5)
  448. AddChoice('Run a Menu',6)
  449. AddChoice('Load MarxHelp',7)
  450. AddChoice('UnLoad MarxHelp',8)
  451.  
  452. CenterStretchBox ('Menu Utilities',38,15)
  453.  
  454. OnKey Task(1)
  455.    ME %MenuFileName
  456.  
  457. OnKey Task(2)
  458.    |FilePicked = PickAFile('*.INC','Include Files')
  459.    |ViewFile(FilePicked)
  460.  
  461. OnKey Task(3)
  462.    |FilePicked = GetIncludeFile
  463.    |if FilePicked > ''
  464.    |   Bat 'ME ' + FilePicked
  465.    |endif
  466.  
  467. OnKey Task(4)
  468.    |FilePicked = PickAFile ('*.MNU','Menus')
  469.    |ViewFile(FilePicked)
  470.  
  471. OnKey Task(5)
  472.    |FilePicked = PickAFile ('*.MNU','Menus')
  473.    |if FilePicked > ''
  474.    |   Bat 'ME ' + FilePicked
  475.    |endif
  476.  
  477. OnKey Task(6)
  478.    |FilePicked = PickAFile ('*.MNU','Menus')
  479.    |if FilePicked > ''
  480.    |   Bat 'MARX ' + FilePicked
  481.    |endif
  482.  
  483. OnKey Task(7)
  484.    |MxCmd = 'MarxHelp'
  485.  
  486. OnKey Task(8)
  487.    |MxCmd = 'MarxHelp /U'
  488.  
  489. ;----- This routines selects a print queue
  490.  
  491. Procedure SelectPrintQueue
  492. var Queue PrnPort QCmd LocalName
  493.  
  494.    LocalName = '<Local Printer>'
  495.    if NumberOfElements(PrintQueueChoices) = 0
  496.       NovMyPrintQueues(PrintQueueChoices)
  497.       SortArray(PrintQueueChoices)
  498.       AppendArray(PrintQueueChoices,LocalName)
  499.    endif
  500.  
  501.    Choices = PrintQueueChoices
  502.    DrawTheBox(28,11,23,Min(12,NumberOfElements(Choices) + HeightDifference),'Print Queues')
  503.    Queue = PickOne(Choices)
  504.    if LastKey = Esc then Return
  505.    Choices = PortChoices
  506.    CenterStretchBox ('Port',38,20)
  507.    PrnPort = Ord(ReadKey) - 64
  508.    if LastKey = Esc then Return
  509.    EraseTopWindow
  510.  
  511.    if Queue = LocalName
  512.       NovEndCapture (PrnPort)
  513.    else
  514.       NovCaptureQueue (PrnPort) = Queue
  515.       NovCaptureTimeOut (PrnPort) = 5
  516.    endif
  517.  
  518. EndProc
  519.  
  520. ;----- This routines selects floppy disk format
  521.  
  522. Procedure SelectFormat
  523. var Ch Message Option
  524.  
  525.    DrawTheBox(20,12,42,4 + HeightDifference,'Format Floppy Disk Menu')
  526.  
  527.    Writeln ' 1 - Format 360    5 - Format /S 360'
  528.    Writeln ' 2 - Format 1.2M   6 - Format /S 1.2M'
  529.    Writeln ' 3 - Format 720    7 - Format /S 720'
  530.    Write   ' 4 - Format 1.4M   8 - Format /S 1.4M'
  531.  
  532.    Ch = ReadKey
  533.  
  534.    if Ch = '1'
  535.       Message = '360k Format with no System Files.'
  536.       Option = '/4'
  537.  
  538.    elseif Ch = '2'
  539.       Message = '1.2m Format with no System Files.'
  540.       Option = ''
  541.  
  542.    elseif Ch = '3'
  543.       Message = '720k Format with no System Files.'
  544.       Option = '/N:9/T:80'
  545.  
  546.    elseif Ch = '4'
  547.       Message = '1.4m Format with no System Files.'
  548.       Option = '/N:18/T:80'
  549.  
  550.    elseif Ch = '5'
  551.       Message = '360k Format with System Files.'
  552.       Option = '/4/S'
  553.  
  554.    elseif Ch = '6'
  555.       Message = '1.2m Format with System Files.'
  556.       Option = '/S'
  557.  
  558.    elseif Ch = '7'
  559.       Message = '720k Format with System Files.'
  560.       Option = '/N:9/T:80/S'
  561.  
  562.    elseif Ch = '8'
  563.       Message = '1.4m Format with System Files.'
  564.       Option = '/N:18/T:80/S'
  565.  
  566.    else
  567.       Return
  568.  
  569.    endif
  570.  
  571.    if DosVersionString >= '5.00'
  572.       Option = Option + '/U'     ;unconditional
  573.       Option = Option + '/V:DOS' ;automatically adds volume label
  574.    endif
  575.  
  576.    DrawTheBox(46,18,11,2 + HeightDifference,'Drive')
  577.    Writeln '  A:'
  578.    Write   '  B:'
  579.    Ch = ReadKey
  580.    if Ch = Esc then Return
  581.    ExecFormat(Ch,Option,Message)
  582. EndProc
  583.  
  584. ;----- Execute FORMAT in a DOS Window
  585.  
  586. Procedure ExecFormat (Drv,Option,Message)
  587. var FormatProg
  588.  
  589.    FormatProg = ExistOnPath('FORMAT.EXE')
  590.    if FormatProg = '' then FormatProg = ExistOnPath('FORMAT.COM')
  591.    if FormatProg = ''
  592.       Error('FORMAT program not Found!')
  593.       Return
  594.    endif
  595.  
  596.    BoxHeader = ' Formatting Drive ' + Drv + ': ' + Message + ' '
  597.    Shadow Off
  598.    DrawBox 1 4 80 21
  599.    Window  4 5 74 19
  600.    Writeln
  601.    ExecProg (FormatProg + ' ' + Drv + ': ' + Option)
  602.    EraseTopWindow
  603. EndProc
  604.  
  605. ;----- Sends a novell message
  606.  
  607. Procedure SendMessage
  608. var Choice Message
  609.    Choice = PickUser('Send message To')
  610.    if Choice = '' then Return
  611.    Message = ReadTextLine('Message:','',0,21)
  612.    if LastKey = Esc then Return
  613.    ClearScreen
  614.    TextColor MenuHeaderFG MenuBG
  615.    Write ' Sending ... '
  616.    ClearScreenFirst Off
  617.    ExecProg ('Send "' + Message + '" to ' + Choice + '>nul')
  618. EndProc
  619.  
  620. ;----- Select Include File
  621.  
  622. Procedure GetIncludeFile
  623. var IncPath
  624.    IncPath = PathPart(ExistOnPath('CUSTOM.INC'))
  625.    IncPath = PickAFile(CleanFileName(IncPath + '\*.INC'),'Include Files')
  626.    if IncPath = '' then Return ''
  627.    DelFile(ForceExtension(%MenuFileName,'MRX'))
  628.    Return IncPath
  629. EndProc
  630.  
  631. ;----- Reads a list of all users on the system
  632.  
  633. Procedure ReadUsers
  634.    if NumberOfElements(AllUsers) > 0 then Return
  635.    NovUsersLoggedIn(AllUsers)
  636.    SortArray(AllUsers)
  637. EndProc
  638.  
  639.  
  640. Procedure PickUser (Message)
  641. var MaxSize
  642.    ReadUsers
  643.    MaxSize = Min(15,NumberOfElements(AllUsers))
  644.    DrawTheBox(46,12 - (MaxSize / 2),20,MaxSize + HeightDifference,Message)
  645.    Return PickOne(AllUsers)
  646. EndProc
  647.  
  648. ;----- Execute a program in a window
  649.  
  650. Procedure ExecProg (Prog)
  651.    TextColor MenuHeaderFG MenuBG
  652.    Cursor Off
  653.    DosWindow
  654.    Execute Prog
  655. EndProc
  656.  
  657.  
  658. Procedure PickAFile (Mask,Message)
  659. var Files Choice MaxSize
  660.    ReadDirectory(Mask,Files)
  661.    MaxSize = Min(15,NumberOfElements(Files))
  662.    if MaxSize = 0
  663.       Error('No Choices!')
  664.       Return ''
  665.    endif
  666.    DrawTheBox(46,12 - (MaxSize / 2),20,MaxSize + HeightDifference,Message)
  667.    Choice = PickOne(Files)
  668.    Return Choice
  669. EndProc
  670.  
  671. ;----- Display Error and Wait for a Key
  672.  
  673. Procedure Error (Err)
  674. var Ch
  675.    BoxHeader = ' Error * Press any Key '
  676.    DrawBox 11 19 Max(27,length(Err) + 4) 3
  677.    Cursor Off
  678.    UseArrows Off
  679.    TextColor MenuHeaderFG MenuBG
  680.    WriteCenter Err
  681.    Write Char(7)
  682.    Ch = ReadKey
  683.    EraseTopWindow
  684. EndProc
  685.